#include <iostream>
using namespace std;
const int N = 10;
// a 个位数字
int a[N+5];
int rel;

int main(){
    int n;
    cin >> n;

    //input
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    //deal
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            if(j != i){
                rel += a[i]*10 + a[j];
            }
        }
    }
    cout << rel;
    return 0;
}